<<<<<<< HEAD
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
	vector<int> n = { 2,6,4,3 };
	vector<int> sum;
	sort(n.begin(), n.end());
	for (int i = 0; i < n.size() / 2; i++) {
		int s = n[i] + n[n.size() - i - 1];
		sum.push_back(s);
	}
	int b = INT_MIN, m = INT_MAX;
	for (int i = 0; i < sum.size(); i++) {
		b = max(b, sum[i]);
		m = min(m, sum[i]);
	}
	cout << b - m << endl;
}
=======
#include <bits/stdc++.h>

using namespace std;

int f(vector<int> v)
{
	vector<int> sum;
	sort(v.begin(), v.end());
	for (int i = 0; i < v.size() / 2; i++) {
		int s = v[i] + v[v.size() - i - 1];
		sum.push_back(s);
	}
	int b = INT_MIN, m = INT_MAX;
	for (int i = 0; i < sum.size(); i++) {
		b = max(b, sum[i]);
		m = min(m, sum[i]);
	}
	return b - m;
}

int main() {
    assert(f({ 2,6,4,3 }) == 1);
    assert(f({ 11,4,3,5,7,1 }) == 3);
    return 0;
}
>>>>>>> 4a2f74fe3914c8611608f9aeccbf166a4021a60c
